<?php $this->load('header')?>

<?php $this->showTabs()?>

<div class="main">
	
	<div class="search">
		<form name="search" method="post" action="<?php echo URL()?>">
			<fieldset>
				<legend>附件查找</legend>
					日期：
					<?php echo $dateOptions;?>
					扩展名：
					<select name="fileext">
					<option value=""></option>
					<?php echo fileExtOptions;?>
					</select>
					文件名：
					<input type="text" name="keyword" size="15" value="<?php echo $keyword;?>" />
					<input type="submit" name="s" class="button" value="开始查找" />
					<input type="button" class="button" value="显示全部" onclick="javascript:window.location.href='<?php echo URL()?>';" />
			</fieldset>
		</form>
	</div>

	<form name="op" method="post" action="<?php echo URL('attach.delete')?>">
		<table cellspacing="0" class="datalist" id="list">
			<tr>
				<th width="30" class="firstcol">选择</th>
				<th width="50">
				<?php
				if ($sort == 'id' && $sorttype == 'desc') {
					echo '<a href="'.URL('','sort=').'" title="按ID从大到小排序">ID↓</a>';
				} else {
					echo '<a href="'.$url.'&id=asc" title="按ID从小到大排序">ID↑</a>';
				}
				?>
				</th>
				<th>文件名</th>
				<th>文件地址</th>
				<th width="90">
				<?php
				if ( $_GET['filesize'] == 'asc') {
					echo '<a href="'.$url.'&filesize=desc" title="从大到小排序">文件大小↓</a>';
				} else {
					echo '<a href="'.$url.'&filesize=asc" title="从小到大排序">文件大小↑</a>';	
				}
				?>
				</th>
				<th width="150">上传时间</th>
				<th width="80">
				<?php
				if ( $_GET['downloads'] == 'asc') {
					echo '<a href="'.$url.'&downloads=desc" title="从多到少排序">下载次数↓</a>';
				} else {
					echo '<a href="'.$url.'&downloads=asc" title="从少到多排序">下载次数↑</a>';	
				}
				?>
				</th>
			</tr>
			<?php
			if ($list) {
			foreach ($list as $row) { 
			?>
			<tr id="row_<?php echo $row['id']?>">
				<td align="center">
				<input type="checkbox" name="id[]" value="<?php echo $row['id']?>" class="checkbox" />
				</td>
				<td align="center"><?php echo $row['id']?></td>
				<td><?php echo $row['originalname']?></td>
				<td><a href="<?php echo $row['filepath']?>" title="查看附件" target="_blank"><?php echo $row['filepath']?></a></td>
				<td align="center"><?php echo $row['filesize']?></td>
				<td align="center"><?php echo $row['dateline']?></td>
				<td align="center"><b><?php echo $row['downloads']?></b></td>
			</tr>
			<?php } ?>
			<tr>
				<td align="center">
				<input type="checkbox" name="chkall" id="chkall" value="1" class="checkbox" onclick="check_all(this)" /></td>
				<td align="center"><label for="chkall">全选</label></td>
				<td colspan="6">
				<input type="submit" class="submit" value="删除附件" /></td>
			</tr>
			<?php } else { ?>
			<tr><td colspan="10">没有符合条件的附件</td></tr>
			<?php } ?>
			<tr>
				<td colspan="10"><?php echo $pageBar;?></td>
			</tr>
		</table>		
	</form>
</div>

<?php $this->load('footer')?>